import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import path from 'path';
// https://vite.dev/config/
export default defineConfig({

  plugins: [react()],
  optimizeDeps: {
    exclude: ['react-bmapgl'], // 不让 Vite 预构建这个库
  },
  // build: {
  //   commonjsOptions: {
  //     include: [/react-bmapgl/, /node_modules/], // 强制将 react-bmapgl 作为 CommonJS 处理
  //   },
  // },
  resolve: {
    alias: {
      '@': path.resolve(__dirname, 'src'),
    },
  },
  server: {
    host: '0.0.0.0', // 允许所有 IP 访问
    port: 5173,      // 可选：指定端口号
    proxy: {
      "/tent": {
        target: "http://192.168.10.79:8611",
        changeOrigin: true,
        // cookieDomainRewrite: "",
        // secure: false,
        rewrite: (path) => path.replace(/^\/tent/, ''),
      },
    },
  },
})
